package com.aloda.controller.admin;

import com.aloda.dto.MerPageDTO;
import com.aloda.result.PageResult;
import com.aloda.result.Result;
import com.aloda.service.MerchandiseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/merchandise")
@Slf4j
public class MerchandiseController {

    @Autowired
    private MerchandiseService merchandiseService;

    /**
     * 商品分页查询
     * @param merPageDTO
     * @return
     */
    @PostMapping("/page")
    public Result<PageResult> pageQuery(@RequestBody MerPageDTO merPageDTO){
        log.info("商品分页查询：{}",merPageDTO);
        PageResult pageResult = merchandiseService.pageQuery(merPageDTO);
        return Result.success(pageResult);
    }
}
